package com.dao.impl;


import com.dao.UserDao;
import com.pojo.User;

public class UserDaoImpl extends BaseDao implements UserDao {

    @Override
    public User QueryUserByUsername(String username) {
        String sql = "select * from t_user where username=?";
       return this.QueryForOne(User.class,sql,username);
    }

    @Override
    public User QueryUserByUsernameAndPassword(String username, String password) {
        String sql="select *from t_user where username=? and password=?";
       return this.QueryForOne(User.class,sql,username,password);
    }

    @Override
    public int SaveUser(User user) {
        String sql = "insert into t_user(username,password,email) values(?,?,?)";
        return this.update(sql,user.getUsername(),user.getPassword(),user.getEmail());
    }
}
